﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Configuration;
using System.IO;

namespace IPSWeb.Logic
{
    public class PSConfigurationManager
    {

        public static List<string> GetPSSnapInsToAdd()
        {
            string value = ConfigurationManager.AppSettings["AddPSSnapIns"];
            if (!string.IsNullOrEmpty(value))
                return value.Split(';').ToList();
            else
                return new List<string>();
        }
        public static List<string> GetPSSnapInsToRemove()
        {
            string value = ConfigurationManager.AppSettings["RemovePSSnapIns"];
            if (!string.IsNullOrEmpty(value))
                return value.Split(';').ToList();
            else
                return new List<string>();
        }

        internal static bool IsScriptsFolderExists()
        {
            if ((!Directory.Exists(ConfigurationManager.AppSettings["UserScriptsDirectoryPath"])) || (string.IsNullOrEmpty(ConfigurationManager.AppSettings["UserScriptsDirectoryPath"])))
                return false;
            else
                return true;
        }
        internal static string GetScriptDirectoryPath()
        {
            return ConfigurationManager.AppSettings["UserScriptsDirectoryPath"];
        }
        internal static string GetStartupScriptPath()
        {
            return GetScriptDirectoryPath() + @"\IPSStartu.ps1";
        }
    }
}
